<?php
/**
 * The template for displaying Category Archive pages.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>
	<!--div id="container">
		<div id="case-split">
		
		</div>			
            <div id="case-main">
		<div id="project-categories-list-wrapper" class="shadow">
					<div id="project-categories-list">
					<h1 class="page-title"><?php printf(single_cat_title( '', false ) );?></h1>
						<ul  id="project-categories">
							<?php wp_list_cats("child_of=19&hide_empty=0");?>	
						</ul>
					</div>	
		</div>
		
		<div id="project-perview-wrapper">
					<ul id="project-perview">
						<?php get_template_part( 'loop', 'case' );?>
					</ul>
					
		</div> 
		
            </div>
        </div><!-- #container -->
	
<script type="text/javascript">
    jQuery(document).ready(function($){

    });
</script>

<div id="home-main">
    <div class="breadcrumbs">
        <?php if(function_exists('bcn_display'))
                {
                bcn_display();
                }?>
     </div>
    <div id="sub-cate-page-title">
        <h3><?php single_cat_title() ?></h3>
    </div>
    <ul id="sub-cate-projects-list">
        <?php
			if (is_category()) {
			global $wp_query;
			$cat_id = $wp_query->get_queried_object_id();
        }
        global $post;
        $args = array( 'numberposts' => 5,'category' =>$cat_id);
        $myposts = get_posts( $args );
        foreach( $myposts as $post ) :	setup_postdata($post); ?>
        <li>
         <?php
        $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
        if ( $images ) {
        $total_images = count( $images );
        $image = array_shift( $images );
        $image_img_tag = wp_get_attachment_image( $image->ID, 'large',1,array('title'=>$post->post_title));
        /*获取图片url*/
        /*
        $img_array = wp_get_attachment_image_src( $image->ID, 'large',1);
        $img_url = $img_array [0];
        */
        /*end 获取图片url*/
        echo ('<a href="');
                        echo the_permalink();
                        echo ('">');
        echo $image_img_tag;
        echo ('</a>');
        }; ?>
        <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
        </li>
        <?php endforeach; ?>
    </ul>



</div>	
<?php get_footer(); ?>
